package org.jbit.news.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jbit.news.biz.NewsBiz;
import org.jbit.news.biz.impl.NewsBizImpl;
import org.jbit.news.entity.News;

public class NewsDelServlet extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
   		response.setCharacterEncoding("utf-8");
   		String nid=request.getParameter("nid");
   		//boolean flag=Boolean.parseBoolean(request.getParameter("flag"));
   		//if(flag){
   			News news=new News();
   			news.setNid(nid);
   			NewsBiz nb=new NewsBizImpl();
   			int num=nb.delNews(news);
   			request.getRequestDispatcher("../newspages/admin.jsp").forward(request, response);
   		//}
	}
	
}
